package com.heima.common.enums;

/**
 * 测试枚举，表示订单状态枚举
 */

public enum TestEnum {

    //3. 列举可能
    ORDER_STATUS_WAITPAY(0, "待支付"),
    ORDER_STATUS_PAYED(1, "已支付"),
    ORDER_STATUS_DELIVERING(2, "代发货"),
    ORDER_STATUS_SIGN(3, "已签收"),
    //..

    ;


    //1.提供属性
    private Integer code;
    private String desc;

    //2.提供私有构造给属性赋值
    TestEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    //4. 提供属性取值方法
    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static void main(String[] args) {
        Integer code = TestEnum.ORDER_STATUS_DELIVERING.getCode();
        System.out.println(code);
        String desc = TestEnum.ORDER_STATUS_DELIVERING.getDesc();
        System.out.println(desc);
    }

}
